package com.jin.service.impl;

import com.jin.entity.ProductCategory;
import com.jin.mapper.ProductCategoryMapper;
import com.jin.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 类目
 * @author JJLiu
 * @create 2021-07-16 8:48
 **/
@Service
public class CategoryServiceImpl implements CategoryService {


    @Autowired
    private ProductCategoryMapper mapper;

    @Override
    public ProductCategory findOne(Integer categoryId) {
        return mapper.selectById(categoryId);
    }

    @Override
    public List<ProductCategory> findAll() {
        return mapper.selectList(null);
    }

    @Override
    public List<ProductCategory> findByCategoryTypeIn(List<Integer> categoryTypeList) {
        return mapper.selectBatchIds(categoryTypeList);
    }

    @Override
    public int save(ProductCategory productCategory) {
        return mapper.insert(productCategory);
    }
}
